<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>li的点击</li>
        <li>li的点击</li>
        <li>li的点击</li>
        <li>li的点击</li>
        <li>li的点击</li>
    </ul>
    <script>
        //事件的委托原理，给父节点添加监听器，利用事件的冒泡原理影响每一个子节点
        var ul = document.querySelector('ul');
        ul.addEventListener('click',function(event) {
            console.log('点击了li，调用ul的点击事件');
            //target可以得到我们点击的对象
            console.log(event.target);
            console.log(this);

            event.target.style.backgroundColor = 'pink';
        })
    </script>
</body>
</html>